<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

    <ui:define name="l_content">
		<ui:include src="/l_content/lc.xhtml" />
    </ui:define>
    
    <ui:define name="body">
    	<h:panelGroup id="myacc_panel">
	    	<rich:tabPanel switchType="client" selectedTab="tab_acc">
	   			<rich:tab name="tab_acc" label="#{messages.my_account_msg}" >
			    	<h:form id="my_account_form">
			    		<table>
			    			<tr>
			    				<td>
			    					<table cellpadding="5" cellspacing="5">
			    						<tr>
							    			<td>
							    				<h:outputText value="#{messages.kadrons_msg}" />
							    			</td>
							    			<td>
							    				<h:outputText value="#{kMyAccount.totalKadrons} K" />
							    			</td>
							    		</tr>
			    						<tr>
							    			<td>
							    				<h:outputText value="#{messages.type_msg}" />
							    			</td>
							    			<td>
							    				<h:outputText value="#{kUser.user.userType.message}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
						    					<h:commandLink action="my_avatar" value="#{messages.picture_msg}" immediate="true" />
							    			</td>
							    			<td>
							    				<h:panelGroup id="thumb_img" rendered="#{not empty kMyAccount.img}" >
							    					<h:commandLink action="my_avatar" immediate="true" >
														<img id="thumb_" src="/#{kInitParam.imgPath}/av_#{kMyAccount.img.userId}/#{kMyAccount.img.thumb}" style="border: 1px solid gray;"/>
							    					</h:commandLink>
												</h:panelGroup>
						    					<h:commandLink action="my_avatar" immediate="true" rendered="#{empty kMyAccount.img}">
													<h:graphicImage value="/img/no-img.gif" />
						    					</h:commandLink>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.k_name_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:outputText value="#{kMyAccount.accountData.username}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.email_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:outputText value="#{kMyAccount.accountData.email}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.nickname_msg}" />
							    			</td>
							    			<td>
							    				<h:inputText value="#{kMyAccount.accountData.nickname}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.firstname_msg}" required="true"/>
								    			<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:inputText value="#{kMyAccount.accountData.firstname}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.lastname_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:inputText value="#{kMyAccount.accountData.lastname}" required="true"/>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.address_msg}" />
							    			</td>
							    			<td>
							    				<h:inputTextarea value="#{kMyAccount.accountData.address}" >
							    					<f:validateLength maximum="255"/>
							    				</h:inputTextarea>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.tel_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:inputText value="#{kMyAccount.accountData.tel}" required="true"/>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.mob_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:inputText value="#{kMyAccount.accountData.mob}" required="true"/>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.birthday_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<rich:calendar value="#{kMyAccount.accountData.birthday}" required="true" showWeeksBar="false" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.gender_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:selectOneMenu value="#{kMyAccount.accountData.gender}" required="true" >
							    					<s:selectItems value="#{kUtilProvider.getGenders()}" var="g" label="#{g.message}" />
							    					<s:convertEnum />
							    				</h:selectOneMenu>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.language_msg}" />
							    				<h:outputText value="*" styleClass="m" />
							    			</td>
							    			<td>
							    				<h:selectOneMenu value="#{kMyAccount.accountData.lang}">
							    					<s:selectItems value="#{kUtilProvider.langs()}" var="l" label="#{l.message}" />
							    					<s:convertEnum />
							    				</h:selectOneMenu>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.newsletter_msg}" />
							    			</td>
							    			<td>
							    				<h:selectBooleanCheckbox value="#{kMyAccount.accountData.newsletter}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.desc_msg}" />
							    			</td>
							    			<td>
							    				<h:inputTextarea value="#{kMyAccount.accountData.desc}" >
							    					<f:validateLength maximum="1000" />
							    				</h:inputTextarea>
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.name_visible_msg}" />
							    			</td>
							    			<td>
							    				<h:selectBooleanCheckbox value="#{kMyAccount.accountData.nameVisible}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.email_visible_msg}" />
							    			</td>
							    			<td>
							    				<h:selectBooleanCheckbox value="#{kMyAccount.accountData.emailVisible}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.birthday_visible_msg}" />
							    			</td>
							    			<td>
							    				<h:selectBooleanCheckbox value="#{kMyAccount.accountData.birthdayVisible}" />
							    			</td>
							    		</tr>
							    		<tr>
							    			<td>
							    				<h:outputText value="#{messages.tel_visible_msg}" />
							    			</td>
							    			<td>
							    				<h:selectBooleanCheckbox value="#{kMyAccount.accountData.telVisible}" />
							    			</td>
							    		</tr>
							   		</table>
							   		<br />
				    				<a:commandButton id="save_id" action="#{kMyAccount.save()}" value="#{messages.save_msg}" 
				    					reRender="myacc_panel, messages" >
				    				</a:commandButton>
			    				</td>
				    			<td valign="top">
				    				 <h:commandButton action="my_orders" value="#{messages.my_orders_msg}" rendered="#{identity.loggedIn}" />
				    			</td>
			    			</tr>
			    		</table>
			    	</h:form>
	    		</rich:tab>    		
	   			<rich:tab name="tab_psw" label="#{messages.change_password_msg}" >
	    			<h:form id="psw_form">
	    				<h:panelGroup id="psw_panel">
		    				<table>
				    			<tr>
					    			<td>
					    				<h:outputText value="#{messages.k_password_msg}" />
					    				<span class="m">*</span>
					    			</td>
					    			<td>
					    				<h:inputSecret value="#{kMyAccount.accountData.password}" required="true" />
					    			</td>
					    		</tr>
					    		<tr>
					    			<td>
					    				<h:outputText value="#{messages.confirm_password_msg}" />
					    				<span class="m">*</span>
					    			</td>
					    			<td>
					    				<h:inputSecret value="#{kMyAccount.accountData.confirmPassword}" required="true" />
					    			</td>
					    		</tr>
		    				</table>
	    				</h:panelGroup>
	    				<br />
	    				<a:commandButton id="save_psw" action="#{kMyAccount.savePassword()}" 
	    					value="#{messages.save_password_msg}" reRender="psw_panel, messages" />
	    			</h:form>
	    		</rich:tab>
	    	</rich:tabPanel>
    	</h:panelGroup>
    </ui:define>
</ui:composition>